<%@page import="data.AuthorizationSession"%>
<%@page import="controller.LoginController.LoginError"%>
<%@page import="misc.Configurations"%>
<%@page import="controller.LoginController"%>
<%
LoginController control = new LoginController();
String username = request.getParameter("username").trim();
String password = request.getParameter("password").trim();

LoginError status = control.isAuthorized(username,password);

if(status==LoginError.ok)
{
    AuthorizationSession.addAuthorizationToken(session);
    session.setAttribute("name",username);
    response.sendRedirect("ManageFiles.jsp");
}
else if(status==LoginError.badlogin)
    response.sendRedirect(Configurations.DefaultPage+"?status=bad");
else
    response.sendRedirect(Configurations.DefaultPage+"?status=error");
%>